﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Threading;

namespace System.DbSizeForecaster
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
        }

        void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            e.Handled = true;

            if (e.Exception is ApplicationException || e.Exception is ArgumentException)
                MessageBox.Show(e.Exception.Message, System.Windows.Forms.Application.ProductName);
            else
                MessageBox.Show(e.Exception.ToString(), System.Windows.Forms.Application.ProductName);
        }
    }
}
